KK书,chapter 3 Practice Exercises KM书 8.1,8.5 1)使用软件built-in函数,完成题目 2)使用自编code,完成题目中的Wald test, Likelihood ratio test 3)使用软件built-in函数,相持计算的argument更换为“exact”、“efron”、“descrete”,重复分析,看看结果差得大不大 R user 可加载下面的包导入数据 library(KMsurv) data(hodg)
KM 8.1
In section 1.10, times to death or relapse (in days) are given for 23 nonHodgkin’s lymphoma (NHL) patients, 11 receiving an allogenic (Allo) transplant from an HLA-matched sibling donor and 12 patients receiving an autologous (Auto) transplant. Also, data on 20 Hodgkin’s lymphoma (HOD) patients, 5 receiving an allogenic (Allo) transplant from an HLAmatched sibling donor and 15 patients receiving an autologous (Auto) transplant is given.
(a) Treating NHL Allo as the baseline hazard function, state the appropriate coding which would allow the investigator to test for any difference in survival functions for the four groups, treating them as four independent groups.
Call:
coxph(formula = Surv(time, delta) ~ new, data = hodg, ties = "breslow")
n= 43, number of events= 26
coef exp(coef) se(coef) z Pr(>|z|)
newallo_hod 1.8297 6.2323 0.6753 2.709 0.00674 **
newautlo_nhl 0.6639 1.9423 0.5643 1.177 0.23939
newauto_hod 0.1537 1.1662 0.5888 0.261 0.79406
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
exp(coef) exp(-coef) lower .95 upper .95
newallo_hod 6.232 0.1605 1.6589 23.414
newautlo_nhl 1.942 0.5149 0.6427 5.870
newauto_hod 1.166 0.8575 0.3677 3.698
Concordance= 0.605 (se = 0.061 )
Likelihood ratio test= 7.89 on 3 df, p=0.05
Wald test = 9.26 on 3 df, p=0.03
Score (logrank) test = 11.08 on 3 df, p=0.01
(b) Treating NHL Allo as the baseline hazard function, state the appropriate coding which would allow the investigator to test for an interaction between type of transplant and disease type using main effects and interaction terms.
model <-coxph(Surv(time,delta)~gtype * dtype,data=hodg,ties ='breslow')summary(model)
Using the data set in Exercise 1, using the Breslow method of handling ties,
Analyze the data by performing a global test of no effect of group as defined in Exercise 8.1(a) on survival. Construct an ANOVA table to summarize estimates of the risk coefficients and the results of the one degree of freedom tests for each covariate in the model.
model2 <-coxph(Surv(time, delta) ~1, ties="breslow", data = hodg)anova(model1, model2)
Analysis of Deviance Table
Cox model: response is Surv(time, delta)
Model 1: ~ new
Model 2: ~ 1
loglik Chisq Df Pr(>|Chi|)
1 -83.350
2 -87.298 7.8942 3 0.04825 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# anova(model1)
Repeat part (a) using the coding as described in Exercise 8.1(b). Furthermore, test the hypothesis of disease type by transplant interaction using a likelihood ratio rest based on this coding. Repeat using the Wald test.
Find point estimates and 95% confidence intervals for the relative risk of death for an NHL Auto transplant patient as compared to an NHL Allo transplant patient.
coef(model1)[2]
newautlo_nhl
0.663868
confint(model1)[2, ]
2.5 % 97.5 %
-0.442074 1.769810
Find the p-value of a test of the hypothesis that the hazard rates are the same for HOD Allo transplants and NHL Allo patients, using the Wald test. Repeat a similar test for Auto patients.
library(aod) # wald.test
Attaching package: 'aod'
The following object is masked from 'package:survival':
rats
Test the hypothesis, using the Wald test, that the hazard rates for Auto transplant and Allo transplant patients are the same for each disease group against the alternative that the hazard rates for Auto transplant and Allo transplant patients for at least one group are different using a two-degree of freedom test of H0 : h(t | NHL Allo) h(t | NHL Auto) and H0 : h(t | HOD Allo) h(t | HOD Auto).